﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Setup_Install : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        

        // 1. Run "installCommon.sql" first
        // 2. Run "installMembership.sql"
        // 3. Run "InstallProfile.sql"
        // 4. Run "InstallRoles.sql"
        // 5. Run "InstallPersonalization.sql"
        // 6. Run "TimeTracker.sql"
        // 7. Create Roles
        // 8. Create Users

        string appPath = HttpContext.Current.Request.ApplicationPath;
        string scriptPath = HttpContext.Current.Request.MapPath(appPath);

        string commonScript = System.IO.File.OpenText(scriptPath + @"\App_Data\installCommon.sql").ReadToEnd();
        string membershipScript = System.IO.File.OpenText(scriptPath + @"\App_Data\installMembership.sql").ReadToEnd();
        string profileScript = System.IO.File.OpenText(scriptPath + @"\App_Data\InstallProfile.sql").ReadToEnd();
        string roleScript = System.IO.File.OpenText(scriptPath + @"\App_Data\InstallRoles.sql").ReadToEnd();
        string personalScript = System.IO.File.OpenText(scriptPath + @"\App_Data\InstallPersonalization.sql").ReadToEnd();
        string timetrackerScript = System.IO.File.OpenText(scriptPath + @"\App_Data\TimeTracker.sql").ReadToEnd();



        System.Web.Security.Roles.CreateRole("Administrator");
        System.Web.Security.Roles.CreateRole("Employee");
        System.Web.Security.Roles.CreateRole("Customer");

        System.Web.Security.Roles.AddUserToRole("banderson@benanderson.net", "Administrator");


    }


}